<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/20
 * Time: 15:00
 */

namespace app\index\model;

use think\Model;
use think\Db;
class PostModel extends Model{
    // 确定链接表名
    protected $table = 'snake_post';
    public function getLists($param){
        $pageNo=1;$pageSize=10;
        if(isset($param['pageNo']) && $param['pageNo']!='' && $param['pageNo']>1) $pageNo=intval($param['pageNo']);
        if(isset($param['pageSize']) && $param['pageSize']!='' && $param['pageSize']>0) $pageSize=intval($param['pageSize']);
        $where=array('status'=>1,'type'=>0);
        if(paramValid($param,'type') && ($param['type']==0 || $param['type']==1)) $where['type']=$param['type'];
        return $this->order('addtime DESC,id DESC')->limit(($pageNo-1)*$pageSize,$pageSize)->select();
    }
}